<template>
	<div class="news2">
		<div class="news2-image">
			<router-link :to="setPath(item.id)">
				<img :src="setImage(item.logo)" onerror="$(this).parent().parent().remove();" />
			</router-link>
		</div>
		<div class="news2-content">
			<div class="news2-title">
				<router-link :to="setPath(item.id)">{{item.title}}</router-link>
			</div>
			<div class="news2-about">
				<span class="news2-from">{{item.source}}</span>
				<span class="news3-button">
					<router-link :to="toList()">[{{currentMenu.name}}]</router-link>
				</span>
			</div>
		</div>
	</div>
</template>

<script>
	import { mapState, mapMutations, mapActions } from 'vuex'
	import store from '@/store'
	export default {
		name: 'news1',
		props: ['item'],
		data() {
			return {

			}
		},
		computed: {
			...mapState({
				currentMenu: state => state.MenuStore.currentMenu
			})
		},
		methods: {
			toList: function() {
				//this.$router.push('/')
				return '/' + this.currentMenu.code
			},
			setPath: function(newsId) {
				return this.currentMenu.code + '/news' + newsId
			},
			setImage: function(url) {
				return store.state.StaticStore.baseUrl + '/data/' + url
			},
			changeArticle: function(arti) {
				store.commit("changeArticle", arti)
			}
		}
	}
</script>